using System;

using System.Xml;
using System.Diagnostics;
using System.IO;

using CUtil;
using CGraph;
using CStock;

namespace CStock
{
	public class Directories :  CStock.StockObjectBase, IDirectories
    {
        #region members

        private string applicationPath;
        private string economyStatusPath;
        private string newsPath;
        private string profilePath;

      
        private string dataItemsPath;

		private string portfolioPath;
		private string descriptionPath;
		
		private string optimizationOutputPath;

        private string tradeSystemsTemplatesPath;

		private string logPath;

		private string indicatorsPathRelative;
		private string simulationPath;

		private string quotesDataPath;
		private string webFilePath;

		private string quoteUpdatePath;
        private string tradersPath;
        private string tradeEconomyPath;
        private string tradeEconomyProfilePath;
        private string depositPath;
        private string assetPath;
        


		private string indicatorsComposedDir;

        #endregion

        #region construct
        /// <summary>
        /// 
        /// </summary>
        public Directories()
        {
            
        }
        public Directories(string appPath)
		{	
			this.applicationPath = appPath;
			Defaults();

		}
		public void Defaults()
		{	
		
			this.economyStatusPath = this.applicationPath + "\\EconomyStatus";
			this.portfolioPath = this.applicationPath + "\\" + "Portfolios"; 
			this.quotesDataPath = this.applicationPath + @"\" + @"SharesQuotes";
            profilePath = this.applicationPath + @"\" + @"ProfilesChart";

			this.descriptionPath = this.applicationPath + "\\C_Texte";
			
            this.tradeSystemsTemplatesPath = this.applicationPath + "\\TradeSystemsTemplates";


			this.indicatorsPathRelative = "Indicators";
			this.simulationPath = this.applicationPath + "\\Simulations";
			this.optimizationOutputPath = this.applicationPath + "\\OptimizationOutput";
			
			this.logPath = this.applicationPath + "\\Log";
            this.tradersPath = this.applicationPath + "\\Traders";
            this.tradeEconomyPath = this.applicationPath + "\\TradeEconomy";
            tradeEconomyProfilePath = this.applicationPath + "\\TradeEconomyProfile";

			quoteUpdatePath = this.applicationPath + "\\QuoteUpdate";

            this.dataItemsPath = this.applicationPath + "\\DataItems";
			this.webFilePath = "http://www.logisel.de/downloads/Quotes/";
            this.assetPath = this.applicationPath + "\\Assets";
            this.depositPath = this.applicationPath + "\\Deposits";
            this.newsPath = this.applicationPath + "\\News";
            this.indicatorsComposedDir = "\\IndicatorsComposed";

		}

        #endregion

        #region Properties - non serializable (from Interface)




        [System.Xml.Serialization.XmlIgnoreAttribute()]
        public string EconomyStatusPath
		{
			get
			{
				return this.economyStatusPath;
			}
			set
			{
                this.economyStatusPath = value;
			}
		}
        [System.Xml.Serialization.XmlIgnoreAttribute()]
        public string NewsPath
        {
            get
            {
                return this.newsPath;
            }
            set
            {
                this.newsPath = value;
            }
        }
	

        [System.Xml.Serialization.XmlIgnoreAttribute()]
		public string OptimizationOutputPath
		{
			get
			{
				return this.optimizationOutputPath;
			}
			set
			{
				this.optimizationOutputPath = value;
			}
		}
		/// <summary>
		/// 
		/// </summary>
		[System.Xml.Serialization.XmlIgnoreAttribute()]
		public string SimulationPath
		{
			get
			{
				return this.simulationPath;
			}
			set
			{
				this.simulationPath=value;
			}
		}
		
		/// <summary>
		/// 
		/// </summary>
        [System.Xml.Serialization.XmlIgnoreAttribute()]
		public string PortfolioPath
		{
			get
			{
				return this.portfolioPath;
			}
			set
			{
				this.portfolioPath=value;
			}
		}
        [System.Xml.Serialization.XmlIgnoreAttribute()]
        public string AssetPath
        {
            get
            {
                return this.assetPath;
            }
            set
            {
                this.assetPath = value;
            }
        }

        [System.Xml.Serialization.XmlIgnoreAttribute()]
        public string DepositPath
        {
            get
            {
                return this.depositPath;
            }
            set
            {
                this.depositPath = value;
            }
        }
         
        /// <summary>
        /// 
        /// </summary>
        [System.Xml.Serialization.XmlIgnoreAttribute()]
        public string TradersPath
        {
            get
            {
                return this.tradersPath;
            }
            set
            {
                this.tradersPath = value;
            }
        }
         /// <summary>
        /// 
        /// </summary>
        [System.Xml.Serialization.XmlIgnoreAttribute()]
        public string TradeEconomyPath
        {
            get
            {
                return this.tradeEconomyPath;
            }
            set
            {
                this.tradeEconomyPath = value;
            }
        }
         /// <summary>
        /// 
        /// </summary>
        [System.Xml.Serialization.XmlIgnoreAttribute()]
        public string TradeSystemsTemplatesPath
        {
            get
            {
                return this.tradeSystemsTemplatesPath;
            }
            set
            {
                this.tradeSystemsTemplatesPath = value;
            }
        }
		/// <summary>
		/// 
		/// </summary>
        [System.Xml.Serialization.XmlIgnoreAttribute()]
		public string LogPath
		{
			get
			{
				return this.logPath;
			}
			set
			{
				this.logPath = value;
			}
		}

//		}
			
	
		/// 
		/// </summary>
        [System.Xml.Serialization.XmlIgnoreAttribute()]
		public string IndicatorsPathRelative
		{
			get
			{
				return this.indicatorsPathRelative;
			}
			set
			{
				this.indicatorsPathRelative = value;
			}
		}
		/// <summary>
		/// 
		/// </summary>
        [System.Xml.Serialization.XmlIgnoreAttribute()]
		public string IndicatorsComposedDir
		{
			get
			{
				return this.indicatorsComposedDir;
			}
			set
			{
                this.indicatorsComposedDir = value;
			}
		}
	
		/// <summary>
		/// GraphConfiguration
		/// </summary>
        [System.Xml.Serialization.XmlIgnoreAttribute()]
		public string QuotesDataPath
		{
			get
			{
				return this.quotesDataPath;
			}
			set
			{
				this.quotesDataPath = value;
			}
		}
        /// <summary>
		/// GraphConfiguration
		/// </summary>
        [System.Xml.Serialization.XmlIgnoreAttribute()]
        public string TradeEconomyProfilePath
		{
			get
			{
				return this.tradeEconomyProfilePath;
			}
			set
			{
                this.tradeEconomyProfilePath = value;
			}
		}

        [System.Xml.Serialization.XmlIgnoreAttribute()]
		public string QuoteUpdatePath
		{
			get
			{
				return this.quoteUpdatePath;
			}
			set
			{
				this.quoteUpdatePath = value;
			}
		}
      [System.Xml.Serialization.XmlIgnoreAttribute()]
        public string DataItemsPath
        {
            get
            {
                return this.dataItemsPath;
            }
            set
            {
                this.dataItemsPath = value;
            }
        }

        [System.Xml.Serialization.XmlIgnoreAttribute()]
		public string WebFilePath
		{
			get
			{
				return this.webFilePath;
			}
			set
			{
				this.webFilePath = value;
			}
		}
        [System.Xml.Serialization.XmlIgnoreAttribute()]
        public string ProfilePath
        {
            get
            {
                return this.profilePath;
            }
            set
            {
                this.profilePath = value;
            }
        }



        //-------------------------------
		#endregion

        #region properties serializable

        /// <summary>
        /// 
        /// </summary>
        /// 
        //[System.Xml.Serialization.XmlIgnoreAttribute()]
        public string ApplicationPath
        {
            get
            {
                return this.applicationPath;
            }
            set
            {
                this.applicationPath = value;
                Defaults();
            }
        }

        //[System.Xml.Serialization.XmlIgnoreAttribute()]
        public string EconomyStatusPathSerialize
        {
            get
            {
                return IOUtil.GetRelativeDirectory(this.economyStatusPath);
                
            }
            set
            {
                this.economyStatusPath = this.applicationPath + "\\" + value;
                
            }
        }
        //[System.Xml.Serialization.XmlIgnoreAttribute()]
        public string NewsPathSerialize
        {
            get
            {
                return IOUtil.GetRelativeDirectory(this.newsPath);
               
            }
            set
            {
                this.newsPath = this.applicationPath + "\\" + value;
               
            }
        }
      
        public string OptimizationOutputPathSerialize
        {
            get
            {
                return IOUtil.GetRelativeDirectory(this.optimizationOutputPath);
                
            }
            set
            {
                this.optimizationOutputPath = this.applicationPath + "\\" + value;
                
            }
        }
        /// <summary>
        /// 
        /// </summary>
        //[System.Xml.Serialization.XmlIgnoreAttribute()]
        public string SimulationPathSerialize
        {
            get
            {
                return IOUtil.GetRelativeDirectory(this.simulationPath);
                
            }
            set
            {
                this.simulationPath = this.applicationPath + "\\" + value;
               
            }
        }

        /// <summary>
        /// 
        /// </summary>
        //[System.Xml.Serialization.XmlIgnoreAttribute()]
        public string PortfolioPathSerialize
        {
            get
            {
                return IOUtil.GetRelativeDirectory(this.portfolioPath);
                
            }
            set
            {
                this.portfolioPath = this.applicationPath + "\\" + value;
                
            }
        }
        //[System.Xml.Serialization.XmlIgnoreAttribute()]
        public string AssetPathSerialize
        {
            get
            {
                return IOUtil.GetRelativeDirectory(this.assetPath);
                
            }
            set
            {
                this.assetPath = this.applicationPath + "\\" + value;
                
            }
        }
        public string DepositPathSerialize
        {
            get
            {
                return IOUtil.GetRelativeDirectory(this.depositPath);
               
            }
            set
            {
                this.depositPath = this.applicationPath + "\\" + value;
                
            }
        }

        /// <summary>
        /// 
        /// </summary>
        //[System.Xml.Serialization.XmlIgnoreAttribute()]
        public string TradersPathSerialize
        {
            get
            {
                return IOUtil.GetRelativeDirectory(this.tradersPath);
               
            }
            set
            {
                this.tradersPath = this.applicationPath + "\\" + value;
                
            }
        }
        /// <summary>
        /// 
        /// </summary>
        //[System.Xml.Serialization.XmlIgnoreAttribute()]
        public string TradeEconomyPathSerialize
        {
            get
            {
                return IOUtil.GetRelativeDirectory(this.tradeEconomyPath);
                
            }
            set
            {
                this.tradeEconomyPath = this.applicationPath + "\\" + value;
                
            }
        }
        /// <summary>
        /// 
        /// </summary>
        //[System.Xml.Serialization.XmlIgnoreAttribute()]
        public string TradeSystemsTemplatesPathSerialize
        {
            get
            {
                return IOUtil.GetRelativeDirectory(this.tradeSystemsTemplatesPath);
                
            }
            set
            {
                this.tradeSystemsTemplatesPath = this.applicationPath + "\\" + value;
                
            }
        }
        /// <summary>
        /// 
        /// </summary>
        //[System.Xml.Serialization.XmlIgnoreAttribute()]
        public string LogPathSerialize
        {
            get
            {
                return IOUtil.GetRelativeDirectory(this.logPath);
                
            }
            set
            {
                this.logPath = this.applicationPath + "\\" + value;
                
            }
        }

        //		}


        /// 
        /// </summary>
        //[System.Xml.Serialization.XmlIgnoreAttribute()]
        public string IndicatorsPathRelativeSerialize
        {
            get
            {
                return IOUtil.GetRelativeDirectory(this.indicatorsPathRelative);
                
            }
            set
            {
                this.indicatorsPathRelative = this.applicationPath + "\\" + value;
               
            }
        }
        /// <summary>
        /// 
        /// </summary>
        //[System.Xml.Serialization.XmlIgnoreAttribute()]
        public string IndicatorsComposedDirSerialize
        {
            get
            {
                return IOUtil.GetRelativeDirectory(this.indicatorsComposedDir);
                
            }
            set
            {
                this.indicatorsComposedDir = this.applicationPath + "\\" + value;
                
            }
        }

        /// <summary>
        /// GraphConfiguration
        /// </summary>
        //[System.Xml.Serialization.XmlIgnoreAttribute()]
        public string QuotesDataPathSerialize
        {
            get
            {
                return IOUtil.GetRelativeDirectory(this.quotesDataPath);
                
            }
            set
            {
                this.quotesDataPath = this.applicationPath + "\\" + value;
               
            }
        }
        /// <summary>
        /// GraphConfiguration
        /// </summary>
        //[System.Xml.Serialization.XmlIgnoreAttribute()]
        public string TradeEconomyProfilePathSerialize
        {
            get
            {
                return IOUtil.GetRelativeDirectory(this.tradeEconomyProfilePath);
                
            }
            set
            {
                this.tradeEconomyProfilePath = this.applicationPath + "\\" + value;
                
            }
        }

        //[System.Xml.Serialization.XmlIgnoreAttribute()]
        public string QuoteUpdatePathSerialize
        {
            get
            {
                return IOUtil.GetRelativeDirectory(this.quoteUpdatePath);
                
            }
            set
            {
                this.quoteUpdatePath = this.applicationPath + "\\" + value;
                
            }
        }
        //[System.Xml.Serialization.XmlIgnoreAttribute()]
        public string DataItemsPathSerialize
        {
            get
            {
                return IOUtil.GetRelativeDirectory(this.dataItemsPath);
                
            }
            set
            {
                this.dataItemsPath = this.applicationPath + "\\" + value;
               
            }
        }

        //[System.Xml.Serialization.XmlIgnoreAttribute()]
        public string WebFilePathSerialize
        {
            get
            {
                return IOUtil.GetRelativeDirectory(this.webFilePath);
                
            }
            set
            {
                this.profilePath = this.applicationPath + "\\" + value;
                this.webFilePath = value;
            }
        }
        //[System.Xml.Serialization.XmlIgnoreAttribute()]
        public string ProfilePathSerialize
        {
            get
            {
                return IOUtil.GetRelativeDirectory(this.profilePath);
            }
            set
            {
                this.profilePath = this.applicationPath + "\\" + value;
            }
        }
        
#endregion


        
    }
	
}
